#ifndef MDMAIN_H_
#define MDMAIN_H_
#pragma once

#include <iostream>
#include "windows.h"
#include "mdspi.h"
#include "mdapi.h"
//using namespace std;

//typedef struct UserLogin
//{
//	TThostFtdcBrokerIDType	BrokerID;
//	TThostFtdcUserIDType	UserID; 
//	TThostFtdcPasswordType	Password;
//}UserLogin;

//typedef struct UserLogin
//{
//	TThostFtdcBrokerIDType	BrokerID;
//	TThostFtdcUserIDType	UserID; 
//	TThostFtdcPasswordType	Password;
//}UserLogin;


//typedef struct UserLogin
//{
//	TThostFtdcBrokerIDType	BrokerID;
//	TThostFtdcUserIDType	UserID; 
//	TThostFtdcPasswordType	Password;
//}UserLogin;



class CMd
{
public:
	CMd(CtpMdApi* papi, CtpMdSpi* pspi):m_papi(papi), m_pspi(pspi){};
	~CMd()
	{
		if (NULL != m_papi)
		{
			delete m_papi;
			m_papi = NULL;
		}
		
		if (NULL != m_pspi)
		{
			delete m_pspi;
			m_pspi = NULL;
		}
	};

public:
	CtpMdApi* m_papi;
	CtpMdSpi* m_pspi;
};

//(out)this part used for main.h
bool md_main(char* pborkeid, char* puserid, char* ppassword, char* pMDFront, unsigned int flag, CMd* &pmd);

bool md_main_logout(CMd* &pmd);

bool md_checkstate(CMd* pmd);

#endif